﻿<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>实时预览Demo</title>
    <style type="text/css">
        div, td, input {
            font-size: 12px;
        }

        .ptzBtn {
            width: 32px;
        }

        #Select1 {
            width: 67px;
        }

        #SelectWnd {
            width: 65px;
        }
    </style>
    <!-- 以下是事件触发函数接口 -->
    <script language="javascript" for="preview" event="MsgNotify(iMsg,iError,szDetail,lWnd,szIndexCode)">
		szMsg = "msg:" + iMsg + ",error:" + iError + ",detail:" + szDetail + "，IndexCode：" + szIndexCode;
		document.frmApp.Result.value = szMsg;
		//return;
		//alert(szMsg);
		//0x02000007事件，控件加载完成时抛出的消息，此时平台根据需要调用以下接口对控件进行初始化
		//（控件内部默认也对应设置了固定参数，但生产现场要使用上次用户设置保存的参数，需要平台把上一次保存的数据设置进去）
		if (iMsg == 0x02000007)
		{
			var _right = "10034,10033,10032,10020,10027,10014,10001,10028,10002,10015,10005,10010,10024,10006,10011,10003,10021,10012,10022,10004,10013,10009,10029";
			preview.SetRightCode(_right);
			var _toolbar = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
				+ "<ToolBar><Item type=\"0\" /><Item type=\"24\" /><Item type=\"5\" />"
				+ "<Item type=\"6\" /><Item type=\"7\" /><Item type=\"8\" />"
				+ "<Item type=\"9\" /><Item type=\"10\" /><Item type=\"12\" />"
				+ "<Item type=\"17\" /><Item type=\"20\" /><Item type=\"21\" />"
				+ "<Item type=\"22\" /><Item type=\"53\" /><Item type=\"54\" /></ToolBar>";
			preview.SetToolBar(_toolbar);//工具栏按钮
			preview.SetToolBarAlwaysShow(0);
			preview.SetInstPlayCfg(30);//即使回放播放时间
			var _snap = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
				+ "<SnapShot><PicType>jpeg</PicType><Quality>80</Quality><SnapMulti>1</SnapMulti>"
				+ "<SnapTimes>3</SnapTimes><TimeSpan>1</TimeSpan><SaveFolder>C:\\Users\\lichanghua\\Documents\\CSC\\capture\\</SaveFolder><KeyWords></KeyWords></SnapShot>";
			preview.SetSnapParam(_snap);//抓图参数设置
			var _record = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
				+ "<VideoRecord><PackType>0</PackType><MaxRecTime>0</MaxRecTime>"
				+ "<PackTime>100</PackTime><PackSize>100</PackSize><SaveFolder>C:\\Users\\lichanghua\\Documents\\CSC\\record\\</SaveFolder><KeyWords></KeyWords></VideoRecord>";
			preview.SetRecordParam(_record);//录像参数设置
		}
    </script>
    <SCRIPT type=text/javascript>
		function LoginPlat()
		{
			//Demo默认使用密码登录方式
			var IP = document.frmApp.IP.value;
			var port = document.frmApp.port.value;
			var UserName = document.frmApp.UserName.value;
			var Password = document.frmApp.Password.value;
			var v1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><LoginInfo><LoginType>2</LoginType><SynLogin>1</SynLogin><IP>"+IP+"</IP><Port>"+port
			+"</Port><UserName>"+UserName+"</UserName><Password>"+Password+"</Password></LoginInfo>";
			//alert(v1);
			var v = preview.LoginPlat(v1);
			if(v != 0)
			alert("登录失败，请查看日志preview.log");
		}

		//新的预览接口，需先登录平台，登录需要耗点时间，稍等（控件自身取Token）
		function StartPreview()
		{
			var Code = document.frmApp.CameraIndexCode.value;
			var _param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview><CamIndexCode>"+Code+"</CamIndexCode></Preview>";

			preview.StartPreview( _param);
		}

		//老预览接口：控件仍然抛事件给平台，由平台传入Token
		//2015.10.8之前的版本，老接口预览，没登录平台token会为空，如果服务要验证token，预览会失败，只能通过登录平台方式预览
		function StartPreviewEx()
		{
			var IP = document.frmApp.VAGIP.value;
			var port = document.frmApp.VAGPort.value;
			var Code = document.frmApp.CameraIndexCode.value;
			//根据平台不同的取流配置方式，控件开始预览接口StartPreviewEx(BSTR szXml)包含以下三种情况
            //取流方式一：过Vag直连取流(非级联)
			var stream_vag_param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview>"
				       + "<StreamSvr>"
					   + "<Svr type=\"3\" ip=\""+IP+"\" port=\""+port+"\"/>"						  //过Vag直连取流：提供监控点所在的Vag服务IP和端口
					   + "</StreamSvr>"
					   + "<CamIndexCode>"+Code+"</CamIndexCode>"						              //监控点编号：对应平台监控点信息"c_index_code"字段
					   + "<CamName>小区Camera01</CamName>"										      //监控点名称：对应平台监控点信息"c_name"字段
					   + "<DevIndexCode>10000000001130000003</DevIndexCode>"                          //监控点所在设备编号：对应平台监控点信息"c_device_index_code"字段
					   + "<LinkType>1</LinkType>"									                  //取流连接协议：1~TCP(默认), 2~UDP，对应平台监控点信息"i_stream_link_type"字段
					   + "<StreamType>0</StreamType>"                								  //码流类型：0~主码流, 1~子码流,对应平台监控点信息"i_stream_type"字段
					   + "<ChannelNo>1</ChannelNo>"										              //监控点所在设备通道号：对应监控点信息“i_channel_no”字段
					   + "<NetZone cnid=\"1\" pnid=\"1\"/>"											  //客户端和设备所在网域Id，内网~1(默认)，外网~2，pnid对应设备信息"i_netDemain_id"字段
					   + "<UserLevel>50</UserLevel>"											      //平台用户等级，50~系统管理员
					   + "<DevType>0</DevType>"												          //监控点所在设备设备厂商类型：0~海康，1~大华，其他参考平台设备,对应平台设备信息"i_device_detail_type"字段
					   + "<ProSeries>1</ProSeries>"											          //监控点所在设备对应产品系列,对应平台设备信息"i_manufacturer"字段
					   + "<TreatyType>SDK</TreatyType>"												  //监控点所在设备产品接入协议：SDK~海康SDK设备, EHOME~EHOME设备, GB28181~国标设备等,对应平台设备信息"c_treaty_type"字段
					   + "<UserName>admin</UserName>"												  //监控点所在设备用户名,对应平台设备信息"c_user_name"字段
					   + "<PassWord>XdMOANI=</PassWord>" 											  //监控点所在设备密码,对应平台设备信息"c_user_pwd"字段
					   + "<FishEyeInfo><InstallType></InstallType><VideoDevType>16</VideoDevType></FishEyeInfo>" //[可选]对于鱼眼监控点使用：安装方式和设备类型
					   + "</Preview>";

			//取流方式二：过流媒体取流(非级联)
			var stream_vtm_param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview>"
				       + "<StreamSvr>"																  //过流媒体取流需同时提供Vag服务和流媒体服务信息，其中流媒体服务可以是Vtm或Vtdu，取决于平台配置的服务
					   + "<Svr type=\"3\" ip=\"10.33.30.205\" port=\"7302\"/>"   					  //Vag服务
					   + "<Svr type=\"4\" ip=\"10.33.30.205\" port=\"557\"/>"						  //Vtm或Vtdu服务
					   + "</StreamSvr>"
					   + "<CamIndexCode>10000000001310000019</CamIndexCode>"						  //监控点编号：对应平台监控点信息"c_index_code"字段
					   + "<CamName>小区Camera01</CamName>"										      //监控点名称：对应平台监控点信息"c_name"字段
					   + "<DevIndexCode>10000000001130000003</DevIndexCode>"                          //监控点所在设备编号：对应平台监控点信息"c_device_index_code"字段
					   + "<LinkType>1</LinkType>"									                  //取流连接协议：1~TCP(默认), 2~UDP，对应平台监控点信息"i_stream_link_type"字段
					   + "<StreamType>0</StreamType>"                								  //码流类型：0~主码流, 1~子码流,对应平台监控点信息"i_stream_type"字段
					   + "<ChannelNo>1</ChannelNo>"										              //监控点所在设备通道号：对应监控点信息“i_channel_no”字段
					   + "<NetZone cnid=\"1\" pnid=\"1\"/>"											  //客户端和设备所在网域Id，内网~1(默认)，外网~2，pnid对应设备信息"i_netDemain_id"字段
					   + "<UserLevel>50</UserLevel>"											      //平台用户等级，50~系统管理员
					   + "<DevType>0</DevType>"												          //监控点所在设备设备厂商类型：0~海康，1~大华，其他参考平台设备,对应平台设备信息"i_device_detail_type"字段
					   + "<ProSeries>1</ProSeries>"											          //监控点所在设备对应产品系列,对应平台设备信息"i_manufacturer"字段
					   + "<TreatyType>SDK</TreatyType>"												  //监控点所在设备产品接入协议：SDK~海康SDK设备, EHOME~EHOME设备, GB28181~国标设备等,对应平台设备信息"c_treaty_type"字段
					   + "<UserName>admin</UserName>"												  //监控点所在设备用户名,对应平台设备信息"c_user_name"字段
					   + "<PassWord>XdMOANI=</PassWord>" 											  //监控点所在设备密码,对应平台设备信息"c_user_pwd"字段
					   + "<FishEyeInfo><InstallType></InstallType><VideoDevType>16</VideoDevType></FishEyeInfo>" //[可选]对于鱼眼监控点使用：安装方式和设备类型
					   + "</Preview>";

			//取流方式三：级联过NCG取流
			var stream_ncg_param = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Preview>"
				       + "<StreamSvr>"																  //级联取流提供NCG服务的IP和端口
					   + "<Svr type=\"8\" ip=\"10.33.30.205\" port=\"7099\"/>"   					  //NCG服务
					   + "</StreamSvr>"
					   + "<CascCode>999999990020000000022</CascCode>"								  //级联监控点编码标志，通过该字段区分是否为级联监控点及是否级联过NCG取流，对应平台监控点信息"c_cascade_privilege"字段
					   + "<DecodeTag>hikvision</DecodeTag>"											  //级联监控点编码标志：hikvision~海康设备，dahua~大华设备，db33~国标设备，通过该字段区别进行解码播放，对应平台监控点信息"c_decode_tag"字段
					   + "<CamIndexCode>10000000001310000019</CamIndexCode>"						  //监控点编号
					   + "<CamName>Camera01</CamName>"												  //监控点名称
					   + "<ChannelNo>1</ChannelNo>"													  //监控点所在设备通道号
					   + "<NetZone cnid=\"1\" pnid=\"\"/>"					   					          //客户端和设备所在网域Id，内网~1，外网~2，注：级联时无设备信息
					   + "<LinkType>1</LinkType>"													  //[预留，暂不使用]取流连接协议：1~TCP(默认), 2~UDP
					   + "<StreamType>0</StreamType>"												  //[预留，暂不使用]码流类型：0~主码流, 1~子码流
					   + "</Preview>";

			//alert(stream_vag_param);
			preview.StartPreviewEx(stream_vag_param);
		}

		function StopPreview()
		{
			var idx = preview.GetSelWnd();
			preview.StopPreview(idx);
		}

		function StopAll()
		{
			var v = preview.StopPreview(-1);
		}

		//以下接口可能不常用，请按需求使用
		function PtzControl()
		{
			var Code = document.frmApp.CameraIndexCode.value;
		    var vFunid = document.frmApp.FunId.value;
		    var CmdId = document.frmApp.CmdId.value;
		    var vSpeed = document.frmApp.Speed.value;
				var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>" + vFunid + "</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify><Param>1</Param>"
									+ "<ControInfo><CmdId>"+CmdId+"</CmdId><Action></Action><Speed>"+vSpeed+"</Speed></ControInfo>"
									+ "<PresetInfo><Info No=\"1\" Name=\"2\" Type=\"1\" /><Info No=\"2\" Name=\"3\" Type=\"2\" /></PresetInfo>"
									+ "<CruiseInfo><Info No=\"1\" Dwell=\"1\" Speed=\"1\" /><Info No=\"2\" Dwell=\"2\" Speed=\"2\" /></CruiseInfo></PtzControl>";
				//alert(_param);
				var v = preview.PtzControl(_param);
				alert(v);
		}

		function AddSecuriteZone()//添加信任站点
		{
			var IP = document.frmApp.IP.value;
			var v = preview.AddSecuriteZone(IP);
		}
		function EnterFishEye()//进入鱼眼模式
		{
			preview.EnterFishEye();
		}
		function ExitFishEye()//退出鱼眼模式
		{
			preview.ExitFishEye();
		}
		function SetLayoutType()//设置窗口布局
		{
			var v = document.frmApp.Layout.value;
			preview.SetLayoutType(v);
		}
		function SetInstPlayCfg()//设置即时回放时间
		{
			var v1 = document.frmApp.data.value;
			var v = preview.SetInstPlayCfg(v1);
		}
		function GetVersion()//获取版本号
		{
			var v = preview.GetVersion();
			alert(v);
		}
		function SetPerCfgInfo()//设置性能计划，如预览大于9路自动切换为子码流，双击放大单窗口显示时自动切换为主码流
		{
			var v1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?><Per><ChgWndNum>9</ChgWndNum><AutoChg>1</AutoChg><DecodePer>5</DecodePer><PlayPer>0</PlayPer></Per>";
			var v = preview.SetPerCfgInfo(v1);
		}
		function EnableMenu()//设置鼠标右键菜单栏是否启用
		{
			var v1 = document.frmApp.data.value;
			var v = preview.EnableMenu(v1);
		}
		function GetDirectoryPath()//弹出目录选择框，返回最终用户选择的路径
		{
			var v = preview.GetDirectoryPath();
		}
		function GetSystemDrive()//获取当前系统驱动盘符
		{
			var v = preview.GetSystemDrive();
			alert(v);
		}
		function GetUserDocument()//获取用户文档目录
		{
			var v = preview.GetUserDocument();
			alert(v);
		}
		function GetSelWndIsPlay()//获取当前选中窗口是否在播放状态
		{
			var v = preview.GetSelWndIsPlay();
			alert(v);
		}

		function SetMainToolBarShow()//设置主工具栏的显示隐藏
		{
			var data = document.frmApp.data.value;
			preview.SetMainToolBarShow(data);
		}
		function SetToolBarVisible()//设置播放窗口的小工具栏的显示隐藏
		{
			var data = document.frmApp.data.value;
			preview.SetToolBarVisible(data);
		}
		function EnableSysCfgButton()//设置系统设置按钮的使能控制
		{
			var data = document.frmApp.data.value;
			preview.EnableSysCfgButton(data);
		}

		function ShowFullScreenButton()//设置切换全屏按钮的显示隐藏
		{
			var data = document.frmApp.data.value;
			preview.ShowFullScreenButton(data);
		}

		//云镜控制各接口
		function zoomin()//焦距缩小
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>12</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";

			var v = preview.PtzControl(_param);
			//alert(v);
		}
		function zoomout()//焦距放大
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>11</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function qianyi()//焦点前移
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>14</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function houyi()//焦点后移
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>13</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function zoomin2()//光圈缩小
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>16</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function zoomout2()//光圈放大
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>15</CmdId><Action></Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function lock()//锁定
		{
			var Code = document.frmApp.CameraIndexCode.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>1</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify><Param>60</Param></PtzControl>";//60秒
			var v = preview.PtzControl(_param);
			alert(v);
		}
		function unlock()//解锁
		{
			var Code = document.frmApp.CameraIndexCode.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>2</FunId> <CamIndexCode>"+Code+"</CamIndexCode><MsgNotify>0</MsgNotify></PtzControl>";//60秒
			var v = preview.PtzControl(_param);
			alert(v);
		}
		function DZoom()//设置当前窗口3D放大状态
		{
			var Code = document.frmApp.CameraIndexCode.value;
			var vDZoom = document.frmApp.data.value;
			if (vDZoom != 0)
			{
				vDZoom = 1;
				document.frmApp.data.value = 0;
			}
			else
				document.frmApp.data.value = 1;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>3</FunId><CamIndexCode>"+Code+"</CamIndexCode><Param>"+vDZoom+"</Param></PtzControl>";
			var v = preview.PtzControl(_param);
			alert(v);
		}
		function dengguang()
		{
			var vOpen = document.frmApp.data.value;//控制打开还是关闭灯光
			if (vOpen != 0)
			{
				vOpen = 1;
				document.frmApp.data.value = 0;
			}
			else
				document.frmApp.data.value = 1;
			var Code = document.frmApp.CameraIndexCode.value;
		  var vFunid = document.frmApp.FunId.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>2</CmdId><Action>"+vOpen+"</Action><Param></Param><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
			alert(v);
		}
		function yushua()
		{
			var vOpen = document.frmApp.data.value;//控制打开还是关闭雨刷
			if (vOpen != 0)
			{
				vOpen = 1;
				document.frmApp.data.value = 0;
			}
			else
				document.frmApp.data.value = 1;

			var Code = document.frmApp.CameraIndexCode.value;
		  var vFunid = document.frmApp.FunId.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>3</CmdId><Action>"+vOpen+"</Action><Param></Param><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
			alert(v);
		}
		function scan()
		{
			var Code = document.frmApp.CameraIndexCode.value;
			var vScan = document.frmApp.data.value;
			if (vScan != 0)
			{
				vScan = 1;
				document.frmApp.data.value = 0;
			}
			else
				document.frmApp.data.value = 1;

		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify><Param>0</Param>"
									+ "<ControInfo><CmdId>29</CmdId><Action>"+ vScan +"</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		//八方向
		function top()//向上
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>21</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function righttop()//右上
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>26</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function right()//向右
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>24</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function rightbottom()//右下
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>28</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function bottom()//向下
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>22</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function leftbottom()//左下
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>27</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function left()//向左
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>23</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}
		function lefttop()//左上
		{
			var Code = document.frmApp.CameraIndexCode.value;
		  var vSpeed = document.frmApp.Speed.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>4</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Wait>0</Wait><MsgNotify>0</MsgNotify>"
									+ "<ControInfo><CmdId>25</CmdId><Action>0</Action><Speed>" + vSpeed + "</Speed></ControInfo></PtzControl>";
			var v = preview.PtzControl(_param);
		}

		//设置预置点
		function SetPresetInfo()
		{
			var Code = document.frmApp.CameraIndexCode.value;
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>7</FunId> <CamIndexCode>"+Code+"</CamIndexCode><MsgNotify>0</MsgNotify>"
									+ "<PresetInfo><Info No=\"1\" Name=\"1\" Type=\"1\" /></PresetInfo></PtzControl>";
			var v = preview.PtzControl(_param);
			alert(v);
		}

		//获取预置点
		function GetPresetInfo()
		{
			var Code = document.frmApp.CameraIndexCode.value;
			var vType = document.frmApp.data.value;//预置点类型：1:预置点 2:巡航
			var _param = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
									+ "<PtzControl><FunId>5</FunId> <CamIndexCode>"+Code+"</CamIndexCode><Param>"+vType+"</Param></PtzControl>";
			var v = preview.PtzControl(_param);
			alert(v);
		}

		//642新增接口
		function EnterEagleEye()
		{
			var vCount = document.frmApp.data.value;//大鹰眼设备节点下监控点个数
			var v = preview.EnterEagleEye(v);
		}
		function ExitEagleEye()
		{
			var v = preview.ExitEagleEye();
		}
		function GetPtzTraceMode()
		{
			var v = preview.GetPtzTraceMode();
			alert(v);
		}
		function SetPtzTraceMode()
		{
			var vState = document.frmApp.data.value;//0或1
			var v = preview.SetPtzTraceMode(vState);
		}
		function SetBrowserType()
		{
			var vType = document.frmApp.data.value;//0或1
			var v = preview.SetBrowserType(vType);
		}
		function SwitchWindow()
		{
			var vIndex1 = document.frmApp.Speed.value;
			var vIndex2 = document.frmApp.data.value;
			var v = preview.SwitchWindow(vIndex1,vIndex2);
			alert(v);
		}
		function SetPlayWndStateText()
		{
			var vData = document.frmApp.Result.value;//0或1
			var vIndex = document.frmApp.data.value;
			var v = preview.SetPlayWndStateText(vIndex,vData);
		}
    </SCRIPT>
</head>
<body>
    <form name="frmApp" mothed="post" action="">
        回调结果
        <input type="text" name="Result" style="width:440px" id="Result" value="">
        监控点编号
        <input type="text" name="CameraIndexCode" style="width:160px" id="CameraIndexCode" value="33010900001310000001">
        布局
        <input type="text" name="Layout" id="Layout" value="1" style="width:40px">
        IP
        <input type="text" name="IP" id="IP" value="10.33.27.144" style="width:120px">
        Port
        <input type="text" name="port" id="port" value="443" style="width:40px">
        UserName
        <input type="text" name="UserName" id="UserName" value="admin" style="width:60px">
        Password
        <input type="text" name="Password" id="Password" value="Abc123++" style="width:100px">
        VAGIP
        <input type="text" name="VAGIP" id="VAGIP" value="10.33.27.144" style="width:120px">
        VAGPort
        <input type="text" name="VAGPort" id="VAGPort" value="7302" style="width:40px">
        云镜FunId
        <input type="text" name="FunId" id="FunId" value="8" style="width:40px">
        云镜CmdId
        <input type="text" name="CmdId" id="CmdId" value="8" style="width:40px">
        云镜Speed
        <input type="text" name="Speed" id="Speed" value="4" style="width:20px">
        data(各接口参数,请直接查看该html)
        <input type="text" name="data" id="data" value="1" style="width:40px">
    </form>
    <div style="width:1300px;height=900px;">
        <div style="width:100%;float:left;overflow:hidden">
            <table width="100%" style="border: thin solid #C0C0C0">
                <tr>
                    <td>登录平台预览功能</td>
                    <td width="65px" align="center"><input type="button" value="LoginPlat" onclick="LoginPlat()" /></td>
                    <td width="65px" align="center"><input type="button" value="StartPreview" onclick="StartPreview()" /></td>
                    <td>不登录平台预览功能</td>
                    <td width="65px" align="center"><input type="button" value="StartPreviewEx" onclick="StartPreviewEx()" /></td>
                    <td width="65px" align="center"><input type="button" value="StopAll" onclick="StopAll()" /></td>
                    <td width="65px" align="center"><input type="button" value="StopPreview" onclick="StopPreview()" /></td>
                </tr>
                <tr>
                    <td>可选功能</td>
                    <td width="65px" align="center"><input type="button" value="GetVersion" onclick="GetVersion()" /></td>
                    <td width="65px" align="center"><input type="button" value="AddSecuriteZone" onclick="AddSecuriteZone()" /></td>
                    <td width="65px" align="center"><input type="button" value="GetSelWndIsPlay" onclick="GetSelWndIsPlay()" /></td>
                    <td width="65px" align="center"><input type="button" value="PtzControl" onclick="PtzControl()" /></td>
                    <td width="65px" align="center"><input type="button" value="EnterFishEye" onclick="EnterFishEye()" /></td>
                    <td width="65px" align="center"><input type="button" value="ExitFishEye" onclick="ExitFishEye()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetLayoutType" onclick="SetLayoutType()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetPerCfgInfo" onclick="SetPerCfgInfo()" /></td>
                    <td width="65px" align="center"><input type="button" value="GetDirectoryPath" onclick="GetDirectoryPath()" /></td>
                </tr>
                <tr>
                    <td width="65px" align="center"><input type="button" value="GetSystemDrive" onclick="GetSystemDrive()" /></td>
                    <td width="65px" align="center"><input type="button" value="EnableMenu" onclick="EnableMenu()" /></td>
                    <td width="65px" align="center"><input type="button" value="GetUserDocument" onclick="GetUserDocument()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetToolBarAlwaysShow" onclick="SetToolBarAlwaysShow()" /></td>
                    <td width="65px" align="center"><input type="button" value="EnableSysCfgButton" onclick="EnableSysCfgButton()" /></td>
                    <td width="65px" align="center"><input type="button" value="ShowFullScreenButton" onclick="ShowFullScreenButton()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetMainToolBarShow" onclick="SetMainToolBarShow()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetToolBarVisible" onclick="SetToolBarVisible()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetInstPlayCfg" onclick="SetInstPlayCfg()" /></td>
                </tr>
                <tr>
                    <td width="65px" align="center"><input type="button" value="EnterEagleEye" onclick="EnterEagleEye()" /></td>
                    <td width="65px" align="center"><input type="button" value="ExitEagleEye" onclick="ExitEagleEye()" /></td>
                    <td width="65px" align="center"><input type="button" value="GetPtzTraceMode" onclick="GetPtzTraceMode()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetPtzTraceMode" onclick="SetPtzTraceMode()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetBrowserType" onclick="SetBrowserType()" /></td>
                    <td width="65px" align="center"><input type="button" value="SwitchWindow" onclick="SwitchWindow()" /></td>
                    <td width="65px" align="center"><input type="button" value="SetPlayWndStateText" onclick="SetPlayWndStateText()" /></td>
                </tr>
            </table>
        </div>

        <div style="width:1000px;float:left;overflow:hidden">
            <table width="100%" style="border: thin solid #C0C0C0">
                <tr>
                    云镜控制(需登录平台)
                    <td width="65px"><input type="button" value="焦距缩小" onclick="zoomin()" /></td>
                    <td width="65px"><input type="button" value="焦距放大" onclick="zoomout()" /></td>
                    <td width="65px"><input type="button" value="焦点前移" onclick="qianyi()" /></td>
                    <td width="65px"><input type="button" value="焦点后移" onclick="houyi()" /></td>
                    <td width="65px"><input type="button" value="光圈缩小" onclick="zoomin2()" /></td>
                    <td width="65px"><input type="button" value="光圈放大" onclick="zoomout2()" /></td>
                </tr>
                <tr>
                    <td width="65px"><input type="button" value="锁定" onclick="lock()" /></td>
                    <td width="65px"><input type="button" value="解锁" onclick="unlock()" /></td>
                    <td width="65px"><input type="button" value="3D放大" onclick="DZoom()" /></td>
                    <td width="65px"><input type="button" value="灯光" onclick="dengguang()" /></td>
                    <td width="65px"><input type="button" value="雨刷" onclick="yushua()" /></td>
                    <td width="65px"><input type="button" value="水平扫描" onclick="scan()" /></td>
                    <td width="65px"><input type="button" value="设置预置点" onclick="SetPresetInfo()" /></td>
                </tr>
                <tr>
                    <!-- 八方向控制 -->
                    <td width="65px"><input type="button" value="向上" onclick="top()" /></td>
                    <td width="65px"><input type="button" value="右上" onclick="righttop()" /></td>
                    <td width="65px"><input type="button" value="向右" onclick="right()" /></td>
                    <td width="65px"><input type="button" value="右下" onclick="rightbottom()" /></td>
                    <td width="65px"><input type="button" value="向下" onclick="bottom()" /></td>
                    <td width="65px"><input type="button" value="左下" onclick="leftbottom()" /></td>
                    <td width="65px"><input type="button" value="向左" onclick="left()" /></td>
                    <td width="65px"><input type="button" value="左上" onclick="lefttop()" /></td>
                </tr>
            </table>
            <!-- 添加预览控件（需要先在windows下注册）width="1361px" height="708px" -->
            <div id="ocxContainer" style="width:100%;height:70%">
                <object classid="clsid:BE020CC9-521F-4641-85E1-3B631B7ADDD9" id="preview" width="800" height="500" name="preview">
                    <PARAM NAME="Ip" VALUE="10.33.27.144" />
                    <PARAM NAME="UserName " VALUE="admin" />
                    <PARAM NAME="PrivilegeCode" VALUE="0401,0402," />
                </object>
            </div>
        </div>
    </div>
    <SCRIPT LANGUAGE="JavaScript" FOR="window" EVENT="onLoad()">
//    	LoginPlat();
    </SCRIPT>
</body>
</html>


